Repository navigation
Conversation
Turns UPower's charge threshold on or off for every battery that supports one. UPower writes the vendor thresholds (or switches charge_types to Long_Life), persists the choice across reboots, and allows the active session to change it without a password. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Shows a Limit/Full row under the power profiles when the battery supports a charge limit, reachable by mouse and keyboard. The percentage is only shown when the laptop really stops at one, not on charging-mode laptops. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
Tested on a Lenovo LOQ 15IAX9E (83ME), Intel + NVIDIA hybrid, Omarchy 4.0.6-1. I ported the script and the panel row into a cloned Hardware
Result
Not tested: reboot persistence, the two-battery path, and the keyboard cursor between the two rows. One unrelated thing I noticed: on this machine the panel header showed "Threshold", "Charge limit -" and "Holding" while the limit was off (battery at 98%, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Laptops that live on the charger wear their battery fastest sitting at 100%. This adds a charge limit switch to the power panel and a matching command.
What it does
omarchy battery charge-limit <on|off|toggle|status>turns UPower's charge threshold on or off for every battery that supports one.Why UPower
UPower's
EnableChargeThresholdalready handles the vendor differences:charge_control_start/end_threshold, or switchescharge_typestoLong_Lifeon laptops that only offer a charging mode.CHARGE_LIMIT, or the 75–80% default./var/lib/upowerand reapplies it at boot.Omarchy doesn't touch sysfs or need root.
Behaviour by hardware
charge_typesonly, e.g. many Dells): the buttons say Limit / Full without a number, since the firmware picks the stopping point.The panel reads the state when it opens and after each change. It is not added to the 5s refresh tick, so it starts no extra processes.
Testing
test/shell.d/battery-charge-limit-test.shfakesupower/busctlfor each case above. NewModel.jstests are inpower-test.sh../test/cli: passes../test/shell: the only failures (background-instant-reload,background-intro-clone,default-apps,elsewhen-migration,launch-browser,screenshot-sanity) fail the same way on an untouchedquattrocheckout on this machine.shell-idle-spawnpasses with the change.charge_control_end_threshold80 → 100 → 80.🤖 Generated with Claude Code